<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>网站信息</title>
    <link rel="stylesheet" href="__ADMIN__/css/pintuer.css">
    <link rel="stylesheet" href="__ADMIN__/css/admin.css">
    <script src="__ADMIN__/js/jquery.js"></script>
    <script src="__ADMIN__/js/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder">友情链接列表</strong></div>

    <div class="padding border-bottom">
        <form method="post" action="{:url('admin/link/lst')}">
            <ul class="search" style="padding-left:10px;">
                <li> <a class="button border-main icon-plus-square-o" href="{:url('admin/link/add')}"> 添加友情链接</a> </li>
                <li>搜索：</li>
                <li>
                    <input type="text" placeholder="请输入链接名称或地址搜索" name="name" class="input" style="width:250px; line-height:17px;display:inline-block" />
                    <button stype="submit" class="button border-main icon-search">搜索</button>
                </li>
            </ul>
        </form>
    </div>
    <table class="table table-hover text-center">
        <tr>
            <th width="5%">ID</th>
            <th>链接名称</th>
            <th>链接地址</th>
            <th>链接图片</th>
            <th>链接排序</th>
            <th>链接状态</th>
            <th>添加时间</th>
            <th>操作</th>
        </tr>
        {volist name="list" id="v"}
        <tr>
            <td>{$v.id}</td>
            <td>{$v.name}</td>
            <td>{$v.link}</td>
            <td><a target="_blank" href="/{$v.img_url}"><img src="/{$v.thumb_url}" width="80px" height="60" alt=""/></a></td>
            <td>{$v.order}</td>
            <td>{$v.status}</td>
            <td>{$v.create_time}</td>
            <td>
                <div class="button-group">
                    <a type="button" class="button border-main" href="{:url('admin/link/edi',['id'=>$v.id])}"><span class="icon-edit"></span>修改</a>
                    <a class="button border-red"  onclick="return del({$v.id})"><span class="icon-trash-o"></span> 删除</a>
                </div>
            </td>
        </tr>
        {/volist}
        <tr>
            <td colspan="8">
                {$page}
            </td>
        </tr>
    </table>
</div>
<script>
    function del(id){
        if(confirm("您确定要删除吗?")){
            $.ajax({
                type : "GET",
                url : "{:url('admin/link/del')}",
                data : "id="+id,
                dataType :'json',
                success:function (data) {
//                    console.log(data);
                    alert(data);
                    location.reload(true);
                },
                error:function (data) {
                },
            })
        }else{
            return false;
        }
    }
</script>
</body></html>